import numpy
import time
import math
from matplotlib import pyplot as plt
import pandas
from pandas import DataFrame


def test01():
    x = [i for i in range(0, 10, 1)]
    y = [j * j + 2 * j + 4 for j in x]
    # y = x*x + 2*x +4
    # plt.figure(figsize=(12, 6))
    plt.plot(x, y)
    z = [i ** 3 + i + 2 for i in x]
    plt.plot(x, z, '+-')
    plt.show()


def test02():
    x = [i for i in range(0, 10)]
    x1 = numpy.array(x)
    print(x1.shape, x1.dtype, x1)
    x[4] = 40
    print(x)
    print(x1)


def test03():
    x = [i for i in range(1, 10)]
    x1 = numpy.array(x)
    # y1 = math.log2(x1)
    # y1 = math.pow(x1, 2)
    y1 = x1 ** 2
    y2 = numpy.log2(x1)
    print(y1, type(y1))
    print(y2)


def test04():
    x = [i for i in range(1, 10)]
    y0 = numpy.array(x)
    y1 = numpy.log2(x)
    y2 = y0 ** 2
    plt.plot(x, y0)
    plt.plot(x, y1)
    plt.plot(x, y2)

    plt.xlim(0,10)
    plt.ylim(0,10)
    plt.show()




if __name__ == '__main__':
    test04()
